package com.djl;

import com.djl.entity.Criteria;
import com.djl.entity.Query;
import com.djl.entity.Student;
import com.djl.repository.StudentRepository;
import com.djl.repository.StudentS;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.Resource;

@SpringBootApplication(excludeName = {"org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration","org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration"})
public class MybatisMain implements CommandLineRunner{

    @Resource
    StudentRepository studentRepository;
    @Resource
    StudentS studentS;

    public static void main(String[] args) {
        SpringApplication.run(MybatisMain.class,args);
    }

    @Override
    public void run(String... args) throws Exception {
//        Student student = studentRepository.selectByQuery(Query.query(Criteria.where(Student::getId).is("dasdas")));

//        Student student1 = studentRepository.selectByQuery(Query.query(Criteria.where(Student::getSAge).is(23)));
//        System.out.println(student);
//        System.out.println(student1);
        Student student = new Student();
        student.setSName("dddd");
        student.setSAge(25);
        student.setId("2333");

        System.out.println(student);

//        studentRepository.update(student);
//        int insert = studentRepository.insert(student);
//        System.out.println(insert);
        int delete = studentRepository.delete(student);
//        Student student = studentRepository.selectByQuery(Query.query(Criteria.where(Student::getSName).is("张三")));
    }



}
